package com.wpam.scrabble.mobile.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.wpam.scrabble.mobile.R;

public class MainActivity extends Activity implements OnClickListener {
	Button buttonCreateGame;
	Button buttonJoinGame;
	Button buttonQuit;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        buttonCreateGame = (Button) findViewById(R.id.create_game);
        buttonJoinGame = (Button) findViewById(R.id.join_game);
        buttonQuit = (Button) findViewById(R.id.quit);
        
        buttonCreateGame.setOnClickListener(this);
        buttonJoinGame.setOnClickListener(this);
        buttonQuit.setOnClickListener(this);
    }

	@Override
	public void onBackPressed() {

		System.exit(0);
		super.onBackPressed();
	}

	public void onClick(View v) {
		
		switch (v.getId()) {
			case R.id.create_game:
				Intent settingsIntent = new Intent(this, GameSettingsActivity.class);
				startActivity(settingsIntent);
				break;
			case R.id.join_game:
				Intent joinIntent = new Intent(this, GameJoinActivity.class);
				startActivity(joinIntent);
				break;
			case R.id.quit:
				finish();
				System.exit(0);
				break;
		}
	}
}
